package main

import (
	"github.com/kataras/iris/v12"
	"github.com/kataras/iris/v12/mvc"
	"github.com/micro/go-micro/v2"
	"github.com/micro/go-micro/v2/web"
	"github.com/micro/go-plugins/registry/etcdv3/v2"
	"gomicro/studentMicro/webClient/controller"
	_ "gomicro/studentMicro/webClient/controller"
	"log"
)

func main() {

	microService := micro.NewService(
		// micro.Selector(),
		micro.Registry(etcdv3.NewRegistry()),
	)

	service := web.NewService(
		web.Name("go.micro.api.student.new"),
		web.Registry(etcdv3.NewRegistry()),
	)

	microService.Init()

	service.Init()
	
	app := iris.New()
	mvc.New(app).Handle(new(controller.StudentMicroController))
	app.Run(iris.Addr(":0002"))

	service.Handle("/", app)

	if err := service.Run(); err != nil {
		log.Fatal(err)
	}

}

/*
自定义负载均衡：创建结构体，实现方法，初始化 //micro.Selector(&结构体实例),
*/